home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4183 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  66 lines

  1. Path: news.db.erau.edu!marseed
  2. From: marseed@news.db.erau.edu (Darryl E. Marsee)
  3. Newsgroups: comp.lang.c
  4. Subject: HELP - why isn't ld working
  5. Date: 2 Feb 1996 15:28:07 GMT
  6. Organization: Embry-Riddle Aeronautical University
  7. Message-ID: <4etai7$22s@deadbird.db.erau.edu>
  8. NNTP-Posting-Host: 155.31.1.1
  9. NNTP-Posting-User: marseed
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Greetings.  Got a user with the following problem:
  13.  
  14. He has two source files, called ex5.c:
  15.  
  16.  #include <stdio.h>
  17.  float input(void);
  18.  main()
  19.  {
  20.      printf("The value entered equals: %f\n", input());
  21.  }
  22.  
  23. and ex5a.c:
  24.  
  25.  float input(void)
  26.  {
  27.     float flop;
  28.     printf("Enter a floating point number: ");
  29.     scanf("%f", &flop);
  30.     return flop;
  31.  }
  32.  
  33. Under Solaris 2.4, SunOS 4.1.4, and AIX 4.1.3 if he does the following:
  34.  
  35.  gcc ex5.c ex5a.c
  36.  
  37. It produces a correctly executing a.out.  So far so good.
  38.  
  39. Again under all three operating systems, if he does the following instead:
  40.  
  41.  gcc -c ex5.c
  42.  gcc -c ex5a.c
  43.  
  44. Everything compiles fine.  However, if he then tries to link them to 
  45. produce an executable with the following:
  46.  
  47.  ld ex5.o ex5a.o -lc
  48.  
  49. On Solaris 2.4 it produces a working a.out, but on SunOS 4.1.4 it produces
  50. an a.out that core dumps with a segmentation fault, and on AIX 4.1.3 it
  51. produces nothing but gives the error message
  52.  
  53.  ld: 0711-327 WARNING: Entry point not found: __start
  54.  ld: 0711-244 ERROR: No csects or exported symbols have been saved.
  55.  
  56. I'm not a C programmer, so I don't have much of a clue what's going on here.
  57. Does anyone have any idea why the ld command he used works under Solaris 2.4 
  58. but not under SunOS 4.1.4 or AIX 4.1.3?
  59.  
  60. Thanks,
  61.  
  62. Darryl Marsee                                   Unix Systems Administrator
  63. marseed@db.erau.edu                            Computer Science Department
  64. http://erau.db.erau.edu/~marseed      Embry-Riddle Aeronautical University
  65. (904) 226-7081                                      Daytona Beach, Florida
  66.